package com.ddwl.goods.controller;


import com.ddwl.common.controller.BaseController;
import com.ddwl.goods.service.AttributeService;
import com.ddwl.schema.bo.goods.AttributeBo;
import com.ddwl.schema.vo.base.RestVo;
import com.ddwl.schema.vo.goods.AttributeVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "属性服务")
@RestController
@RequestMapping("attribute")
public class AttributeController extends BaseController {

    @Autowired
    public AttributeService attributeService;

    @PostMapping("getAttribute")
    @ApiOperation("属性获取 ")
    public RestVo<List<AttributeVo>> getAttribute(@RequestBody AttributeBo attributeBo) {
        return RestVo.ok(attributeService.getAttribute(attributeBo));
    }

    @PostMapping("create")
    @ApiOperation("属性创建")
    public RestVo<String> create(@RequestBody AttributeBo attributeBo) {
        return RestVo.ok(attributeService.create(attributeBo));
    }

    @DeleteMapping("delete/{id}")
    @ApiOperation("属性删除")
    public RestVo<String> delete(@PathVariable("id") String id) {
        return RestVo.ok(attributeService.delete(id));
    }

}
